﻿@{
    ViewBag.Title = "WrapHtml";
    Layout = "~/Views/Shared/_Page.cshtml";
}

<style type="text/css">
	.highlight {
		width: 300px;
        border: 3px double green;
    }   
</style>

<h2>Wrap Html</h2>

<ul>
	<li>Marketing</li>
	<li>Sales</li>
	<li>Technology</li>
	<li>Customer Support</li>
</ul>
   
<input id="btnTestIt" type="button" value="Test It">

<script type="text/javascript">
    $(document).ready(function () {
        $("#btnTestIt").click(function () {
            if (!$("ul").parent().hasClass('highlight')) {
                $("ul").wrap("<div class='highlight'></div>");
            }
        });
    });
</script>